<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/style.css" />
    <script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/bootstrap.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/ckform.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/common.js"></script>

 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
<form  method="post" class="definewidth m20">
<input type="hidden" name="id" value="<?php echo ($user["id"]); ?>" />
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td width="10%" class="tableleft">id</td>
            <td><input id="id" type="text" name="id" value="<?php echo ($list["id"]); ?>" disabled/></td>
        </tr>
        <tr>
            <td class="tableleft">项目id</td>
            <td><input id="projectid" type="text" name="projectid" value="<?php echo ($list["projectid"]); ?>" disabled/></td>
        </tr>
        <tr>
        <tr>
            <td class="tableleft">奖品名</td>
            <td><input id="jpname" type="text" name="start_gailv" value="<?php echo ($list["name"]); ?>"/></td>
        </tr>
        <tr>
        <tr>
        <tr>
            <td class="tableleft">中奖范围</td>
            <td><input id="start_gailv" type="text" name="start_gailv" value="<?php echo ($list["start_gailv"]); ?>"/></td>
        </tr>
        <tr>
        <tr>
            <td class="tableleft">中奖范围</td>
            <td><input id="end_gailv" type="text" name="end_gailv" value="<?php echo ($list["end_gailv"]); ?>"/></td>
        </tr>
        <tr>
            <td class="tableleft">月中奖次数</td>
            <td><input id="yuegailv" type="text" name="yuegailv" value="<?php echo ($list["yuegailv"]); ?>" /></td>
        </tr>
        <tr>
            <td class="tableleft">日中奖次数</td>
            <td><input id="rigailv" type="text" name="rigailv" value="<?php echo ($list["rigailv"]); ?>"/></td>
        </tr>
        <tr>
            <td class="tableleft">发券(没有为空)</td>
            <td><input id="quan" type="text" name="quan" value="<?php echo ($list["quan"]); ?>"/></td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td>
                <button type="button" onclick="save()" class="btn btn-primary" type="button">保存</button>				 &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
            </td>
        </tr>
    </table>
</form>
</body>
</html>

<script>
    function save(){
        var id = $('#id').val();
        var projectid = $('#projectid').val();
        var jpname = $('#jpname').val();
        var start_gailv = $('#start_gailv').val();
        var end_gailv =$('#end_gailv').val();
        var yuegailv = $('#yuegailv').val();
        var rigailv =$('#rigailv').val();
        var quan =$('#quan').val();

        if(!id || !projectid || !start_gailv || !end_gailv || !yuegailv || !rigailv ){
            alert('请把信息补全!');
            return;
        }

        $.ajax({
            type : "post",
            dataType : "text",
            url : "<?php echo U('Activity/savegailv');?>",
            data : {
                id : id,
                projectid : projectid,
                jpname : jpname,
                start_gailv : start_gailv,
                end_gailv : end_gailv,
                yuegailv : yuegailv,
                rigailv : rigailv,
                quan : quan
            },
            success : function(msg) {
                console.log(msg);
                //alert(msg);
                if (msg == 0) {
                    window.location.href = "<?php echo U('Activity/index');?>";
                    alert('修改成功'+msg);
                }

            }
        });
    }

    $(function () {
        $('#backid').click(function(){
            window.location.href="index.html";
        });

    });
</script>